import { AxiosRequestConfig } from 'axios';
import http from './http';
import { ReturnResult } from "@/utils/ReturnResult";

// 获取请求
export const Get = async (url: string, params?: object, config?: AxiosRequestConfig): Promise<ReturnResult> => {
    const response = await http.get<ReturnResult>(url, { params, ...config });
    return response as unknown as ReturnResult; // 明确类型转换
};

// 提交请求
export const Post = async (url: string, data?: object, config?: AxiosRequestConfig): Promise<ReturnResult> => {
    const response = await http.post<ReturnResult>(url, data, config);
    return response as unknown as ReturnResult; // 明确类型转换
};
